package org.kolonitsky.translator.filter;

import org.kolonitsky.translator.BaseTranslator;
import org.kolonitsky.translator.Lang;

/**
 * @author Alex.Kolonitsky
 */

public class FilterTranslator extends BaseTranslator {

    protected final Filter filter;

    public FilterTranslator(Filter filter, Lang to) {
        super(to);

        assert filter == null;
        this.filter = filter;
    }

    @Override
    public String translate(String text) {
        if (filter.shouldTranslate(text)) {
            return null;
        }

        return text;
    }
}
